<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<div class="content">
			<h1>更新用户信息</h1>
			<p>
				更改用户名<input type="text" name="nicename" id="nicename" value="" />
			</p>
			<p>
				<input type="button" name="btn" id="btn" value="更新" />
			</p>
		</div>
	</body>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	<script type="text/javascript">
		$("#btn").click(function() {
			updatas()
		})

		function updatas() {
			var token = localStorage.getItem("token");
			$.ajax({
				type: "patch",
				url: "http://120.48.109.174:8081/user",
				async: true,
				headers: {
					"authorization": token
				},
				data: {
					"nickname": $("#nicename").val()
				},
				success: function(res) {
					console.log(res)
					if(res.status == 200) {
						alert("更新成功")
						location.href = "getUserInfor.html"
					}
				}
			});
		}
	</script>

</html>